Przykad 4.7. Realizacja sortowania szybkiego w jzyku C
/**
 * Sortuj tablic ar[left, right] metod sortowania szybkiego.
 * Funkcja cmp suy do odpowiedniego porwnywania elementw.
 */
void do_qsort (void **ar, int(*cmp)(const void *, const void *),
                            int left, int right) {
   int pivot_Index;
   if (right <= left) { return; }

   /* Podzia */
   pivot_Index = selectPivotIndex(ar, left, right);
   pivot_Index = partition(ar, cmp, left, right, pivot_Index);

   if (pivot_Index-1 - left <= minSize) {
      insertion(ar, cmp, left, pivot_Index-1);
   } else {
      do_qsort(ar, cmp, left, pivot_Index-1);
   }
   if (right - pivot_Index-1 <= minSize) {
      insertion(ar, cmp, pivot_Index+1, right);
   } else {
      do_qsort(ar, cmp, pivot_Index+1, right);
   }
}

/** Szybkie sortowanie bezporednie */
void sortPointers (void **vals, int total_elems,
                   int(*cmp)(const void *, const void *)) {
   do_qsort(vals, cmp, 0, total_elems-1);
}
